package com.atguigu.controller;

import com.atguigu.controller.base.ViewBaseServlet;
import com.atguigu.pojo.Book;
import com.atguigu.pojo.PageInfo;
import com.atguigu.service.BookService;
import com.atguigu.service.impl.BookServiceImpl;
import lombok.SneakyThrows;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author luoyin
 * @Date 16:38 2022/7/18
 * @Description 首页
 **/
@WebServlet("/index.html")
public class IndexController extends ViewBaseServlet {
    @SneakyThrows
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        /*BookService bookService = new BookServiceImpl();
        //List<Book> bookList=bookService.selectAll();
        // req.setAttribute("bookList",bookList);
        String currentPage =req.getParameter("currentPage");
        if (currentPage == null){
            currentPage="1";
        }
        PageInfo<Book> pageInfo = bookService.selectByPage(Integer.parseInt(currentPage));
        req.setAttribute("pageInfo",pageInfo);*/
        processTemplate("index",req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
